<?php
$this->Html->addCrumb('Image Gallery', '/image-gallery-admin');
$this->Html->addCrumb('Albums', '/admin/albums');
$this->Html->addCrumb('Add');
?>
<?php 
$this->Html->scriptStart(array('inline' => false));
echo '
      $(function(){
        $("#AlbumAdminAddForm").TWS_Form( {
          validate : {
          rules : {
            AlbumName : {required : true, help : "This is the name of the album"},
            AlbumCategoryId : {help : "This is the category the album belongs to", required : true}
          }
          }});
        });
       ';
$this->Html->scriptEnd();
?>
<h1>Add Album</h1>
<?php if(isset($categoryInfo)) { ?>
   <span class="bold">Category::</span> <?php echo $this->Html->link($categoryInfo['Category']['name'], array('controller' => 'albums', 'action' => 'index', 'admin'=>true, $categoryInfo['Category']['id']));?>
<?php } ?>
<?php echo '<div id="actionLink"><p>'.$this->Html->link('Back to list of Albums',array('action'=>'index','admin'=>true)).'</p></div>'; ?>

<?php echo $this->element('errors', array('errors' => isset($errors)? $errors : null)); ?>
<?php

echo $this->TWSForm->create('Album',  array(
    'inputDefaults' => array(
        'div' => array('class'=>'row')),
        'class'=>'inlineForm',
        'type'=>'file'));

echo $this->TWSForm->input('category_id', array('name'=>'AlbumCategoryId', 'type'=>'select', 'label'=>'Category', 'options'=>$options));
echo $this->TWSForm->input('name', array('name'=>'AlbumName', 'type'=>'text','size'=>'63', 'label'=>'<span class="required">*</span>Name'));
echo $this->TWSForm->input('description', array('rows'=>'5','cols'=>'60','name'=>'AlbumDescription'));
echo $this->TWSForm->end( array("label"=>"Add", "class"=>"button"));


?>